<template>
<el-cascader 
    ref="main"
    class="l-cascader"
    v-model="value2"

  :size="size"
  clearable
  
  :multiple="multiple"
  :value-key="valueKey"
  :disabled="disabled" 
  :placeholder="placeholder"
  :filterable="filterable"
  >
</el-cascader>

</template>
<script>
import { validatenull } from '@util/validate';
export default {
  name:'l-select',
  props: {
    value:{},
    placeholder:String,
    labelKey:{
      type:String,
      default:'label'
    },
    valueKey:{
      type:String,
      default:'value'
    },
    size:String,
    options: {
      type: Array,
      default: () => {
        return [];
      }
    },
    disabled:Boolean,
    filterable:Boolean,
    multiple:Boolean
  },
  created(){
  },
  data () {
    return {
    };
  },
  mounted () {
  },
  computed:{
    value2:{
      get(){
        if(!validatenull(this.value)){
            return (this.value + '').split(',');
        }
        else{
            return [];
        }
      },
      set(val){
        if(this.multiple){
          this.$emit('input', String(val));
        }
        else{
            this.$emit('input', val);
        }
        this.$emit('change', val);
      }
    }
  },
  methods:{
  }
}
</script>
<style lang="less">
@import './index.less';
</style>
